VERSION 5.00 Begin VB.Form frmMain Caption = "CoolCaption" ClientHeight = 1215 ClientLeft = 60 ClientTop = 345 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 1215 ScaleWidth = 4680 StartUpPosition = 3 'Windows Default Begin VB.Label Label1 Alignment = 2 'Center Caption = $"frmMain.frx":0000 Height = 975 Left = 120 TabIndex = 0 Top = 120 Width = 4455 End Attribute VB_Name = "frmMain" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim myFont As New CDXVBFont Dim sCaption As String Private Sub Form_Load() ' Create the new font normal width, but 15 pixels high myFont.CreateNewFont "harlow solid italic", , 15 Dim wndDC As Long sCaption = "Gilbsoft -" wndDC = GetWindowDC(Me.hWnd) fw = myFont.GetTextWidth(Me, " ") myFont.SetFont wndDC nfw = myFont.GetTextWidth(Me, sCaption) tfw = Int(nfw / fw) For i = 1 To tfw + 2 ts = ts & " " Next i Me.Caption = ts & Me.Caption End Sub Private Sub Form_Paint() Dim wndDC As Long Dim wndRect As RECT Dim captRect As RECT sCaption = "Gilbsoft -" wndDC = GetWindowDC(Me.hWnd) GetWindowRect Me.hWnd, wndRect X = GetSystemMetrics(SM_CXSIZE) + _ GetSystemMetrics(SM_CXBORDER) + _ GetSystemMetrics(SM_CXFRAME) Y = GetSystemMetrics(SM_CYFRAME) + 2 captRect.Top = Y captRect.Left = X captRect.Right = wndRect.Right - wndRect.Left - 2 * X - GetSystemMetrics(SM_CXFRAME) captRect.Bottom = GetSystemMetrics(SM_CYSIZE) + 2 myFont.SetFont wndDC SetBkMode wndDC, TRANSPARENT SetTextColor wndDC, GetSysColor(COLOR_CAPTIONTEXT) DrawText wndDC, sCaption, Len(sCaption), captRect, DT_LEFT ReleaseDC Me.hWnd, wndDC End Sub